﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="/Scripts/shared/share.js" type="text/javascript"></script>
<script src="/Scripts/shared/shown.js" type="text/javascript"></script>
<div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
    <table style="width:100%;">
        <tr>
            <td style="width:100%;">
                <a class="mini-button" id="fresh" name="fresh" iconCls="icon-search" onclick="LoadListData" plain="true">刷新</a>
                 <span class="separator"></span>
                <a class="mini-button" id="save" name="save" iconCls="icon-edit" onclick="modify" plain="true">修改</a>
                <span class="separator"></span>
                <a class="mini-button" id="close" name="close" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
            </td>
        </tr>
    </table>       
</div>
@Html.Partial("~/Views/Modular/SearchInfo.cshtml")
<div class="mini-fit">
    <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;" pagesize="15"
        borderstyle="border:1;" url="/Coupon/GetWxCouponList"
        allowcellselect="true" allowcelledit="true" showcolumnsmenu="true" fitcolumns="false"
        onrowdblclick="modify" sortmode="client">
        <div property="columns">
            <div type="checkcolumn">选行</div>
            <div type="indexcolumn" width="40" headeralign="center">序号</div>
            <div field="FNumber" name="FNumber" width="100" headeralign="center" allowsort="true" required="true">编码</div>
            <div field="FName" name="FName" width="150" headeralign="center" allowsort="true" required="true">名称</div>
            <div field="FDiscount" name="FDiscount" width="100" headeralign="center" allowsort="true" required="true">折扣</div>
            <div field="FWxCardID" name="FWxCardID" width="150" headeralign="center" allowsort="true" >微信会员卡id</div>
            <div field="FLogoUrl" name="FLogoUrl" width="150" headeralign="center" allowsort="true" >会员卡logo</div>
            <div field="FBackgroundPicUrl" name="FBackgroundPicUrl" width="150" headeralign="center" align="right" allowsort="true" >会员卡背景图</div>
            <div field="FNotice" name="FNotice" width="150" headeralign="center" allowsort="true" >使用提醒</div>
            <div field="FDescription" name="FDescription" width="150" headeralign="center" allowsort="true" >使用说明</div>
        </div>
    </div>
</div>
    <div>
        <table>
            <tr>
                <td >提示：如果未显示微信会员卡资料，请联系软件厂家开通微信会员功能。</td>
            </tr>
        </table>
    </div>
<script>
    function FormShown() {

        mini.parse();
        LoadListData();
    }

    //加载资料列表
    function LoadListData() {
        var param= {
            mSystemAppID:parent.window.getSystemAppID()
        }
        var grid = mini.get("datagrid1");
        grid.load(param);
    }

    function modify() {
        var grid = mini.get("datagrid1");
        var row = grid.getSelected();
        if (row) {
            mini.open({
                url: "/Coupon/WxCouponInfo",
                title: "微信会员卡明细",
                width: 900,
                height: 600,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var data = {
                        action: "edit",
                        FItemID: row.FItemID,
                        FName:row.FName,
                        FWxCardID: row.FWxCardID,
                        FLogoUrl: row.FLogoUrl,
                        FBackgroundPicUrl: row.FBackgroundPicUrl,
                        FNotice: row.FNotice,
                        FDescription: row.FDescription,
                        FQuantity: row.FQuantity,
                        FPrerogative: row.FPrerogative,
                        FQrCodeUrl: row.FQrCodeUrl
                    };
                    iframe.contentWindow.SetInfoData(data);
                },
                ondestroy: function (action) {
                    LoadListData();
                }
            });

        } else {
            mini.alert("请选中一条记录");
        }
    }


</script>